#ifndef MDK_EP_H
#define MDK_EP_H

#include <sys/epoll.h>  
#include <fcntl.h>  

#define EP_INTERVAL_CNT  1024
#define MC_U32_ROUND_CHECK(T1,T2)  ((T2) >= (T1)) ? ((T2) - (T1)): (0xFFFFFFFF - (T1) + (T2) )


typedef struct 
{  
	int fd;  
	int (*call_back)(int fd, int events, void *arg);  
	int events;  
	void *arg;
	int status; // 1: in epoll wait list, 0 not in  
#ifdef EP_INTERVAL_DEBUG_FTR
	unsigned int v_CountAll;
	unsigned int v_CountFilterd;
	unsigned int v_MaxExec;
	unsigned int v_MaxRxInterval;

	unsigned int v_LastTick;
	unsigned int v_exeCnt;
	unsigned int v_exeCur;
	unsigned int a_ExecTick[EP_INTERVAL_CNT];
	unsigned int a_IntervalTick[EP_INTERVAL_CNT];
#endif
}myevent_s;



//////////////////////////////////////////////////////////////////////////
int eventDel(int epollFd, myevent_s *ev);
int eventAdd(int epollFd, int events, myevent_s *ev);
void eventSet(myevent_s *ev, int fd, int (*call_back)(int, int, void*), void *arg);
#endif

